package cn.flightcloud.service.file.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class MvcConfig extends WebMvcConfigurationSupport {

//	@Override
//	protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
//		HttpMessageConverter<?> additional = new StringHttpMessageConverter();
//		converters.add(additional);
//		super.extendMessageConverters(converters);
//	}

	@Override
	protected void addViewControllers(ViewControllerRegistry registry) {
		registry.addViewController("/oauth/confirm_access").setViewName("authorize");
		super.addViewControllers(registry);
	}

	/**
	 * 静态资源配置
	 */
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/css/**").addResourceLocations("classpath:/static/css/");
		registry.addResourceHandler("/js/**").addResourceLocations("classpath:/static/js/");
		super.addResourceHandlers(registry);
	}

}
